package com.example.administrator.himalaya.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.himalaya.R;

public class Helper_ZLActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView mBack;
    private ImageView mIM1;
    private ImageView mIM2;
    private boolean isOpen = true;
    private RelativeLayout mLayout1;
    private RelativeLayout mLayout2;
    private TextView mTX1;
    private TextView mTX2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_helper__zl);
        mBack = (ImageView) findViewById(R.id.back);

        mLayout1 = (RelativeLayout) findViewById(R.id.layout1);
        mLayout2 = (RelativeLayout) findViewById(R.id.layout2);
        mIM1 = (ImageView) findViewById(R.id.IM1);
        mIM2 = (ImageView) findViewById(R.id.IM2);

        mLayout1.setOnClickListener(this);
        mLayout2.setOnClickListener(this);

        mTX1 = (TextView) findViewById(R.id.TX1);
        mTX2 = (TextView) findViewById(R.id.TX2);

        mTX1.setOnClickListener(this);
        mTX2.setOnClickListener(this);
        mBack.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.layout1:
                if(isOpen){
                    mTX1.setVisibility(View.GONE);
                    mIM1.setImageResource(R.mipmap.live_category_fold);
                    isOpen = false;
                }else {
                    mTX1.setVisibility(View.VISIBLE);
                    mIM1.setImageResource(R.mipmap.live_category_unfold);
                    isOpen = true;
                }
                break;
            case R.id.layout2:
                if(isOpen){
                    mTX2.setVisibility(View.VISIBLE);
                    mIM2.setImageResource(R.mipmap.live_category_unfold);
                    isOpen = false;
                }else {
                    mTX2.setVisibility(View.GONE);
                    mIM2.setImageResource(R.mipmap.live_category_fold);
                    isOpen = true;
                }
                break;
        }
    }
}
